package com.whut.whw.find;

import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

/**
 * <pre>
 *     author : 杨丽金
 *     time   : 2017/06/11
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class MySwipeRefreshLayout extends SwipeRefreshLayout {
    private View mStickyNavLayout;

    public void setmStickyNavLayout(View mStickyNavLayout) {
        this.mStickyNavLayout = mStickyNavLayout;
    }

    public MySwipeRefreshLayout(Context context) {
        super(context);
    }

    public MySwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (mStickyNavLayout != null) {
            //ToastUtils.showShort(mBanner.getScrollY()+"");
            if (mStickyNavLayout.getScrollY() != 0) return false;
        }
        return super.onInterceptTouchEvent(ev);
    }


}
